package com.hxzy.service.impl;

import com.hxzy.entity.UmsMemberLoginLog;
import com.hxzy.mapper.UmsMemberLoginLogMapper;
import com.hxzy.service.UmsMemberLoginLogService;
import com.hxzy.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

public class UmsMemberLoginLogServiceImpl implements UmsMemberLoginLogService {
    @Override
    public UmsMemberLoginLog selectByPrimaryKey(Long id) {
        UmsMemberLoginLog umsMemberLoginLog=null;
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            UmsMemberLoginLogMapper mapper=session.getMapper(UmsMemberLoginLogMapper.class);
            umsMemberLoginLog =  mapper.selectByPrimaryKey(id);
        }
        return umsMemberLoginLog;
    }

    @Override
    public boolean insert(UmsMemberLoginLog record) {
        int count=0;
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            UmsMemberLoginLogMapper mapper=session.getMapper(UmsMemberLoginLogMapper.class);
            count =  mapper.insert(record);
        }
        return count>0;
    }

    @Override
    public boolean updateByPrimaryKey(UmsMemberLoginLog record) {
        int count=0;
        try (SqlSession session= MybatisUtil.getSqlSessionFactory().openSession()){
            UmsMemberLoginLogMapper mapper=session.getMapper(UmsMemberLoginLogMapper.class);
            count =  mapper.updateByPrimaryKey(record);
        }
        return count>0;
    }
}
